package com.gitee.kamismile.stone.rpc.common.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@ConfigurationProperties(prefix = "spring.ex-stone-rpc")
public class StoneRpcConfigProperties {
    private int port;
    private String host;
    private  String coreThreads;
    private  String maxThreads;
    private  String maxIdleInSecond;
    private  String maxQueueSize;
    private final Map<String, String> userAttributes = new HashMap<String, String>();
    private final Map<String, StoneRpcConfigProperties.StoneServerProvider> servers = new HashMap<String, StoneRpcConfigProperties.StoneServerProvider>();

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Map<String, String> getUserAttributes() {
        return userAttributes;
    }

    public Map<String, StoneServerProvider> getServers() {
        return servers;
    }

    public String getCoreThreads() {
        return coreThreads;
    }

    public void setCoreThreads(String coreThreads) {
        this.coreThreads = coreThreads;
    }

    public String getMaxThreads() {
        return maxThreads;
    }

    public void setMaxThreads(String maxThreads) {
        this.maxThreads = maxThreads;
    }

    public String getMaxIdleInSecond() {
        return maxIdleInSecond;
    }

    public void setMaxIdleInSecond(String maxIdleInSecond) {
        this.maxIdleInSecond = maxIdleInSecond;
    }

    public String getMaxQueueSize() {
        return maxQueueSize;
    }

    public void setMaxQueueSize(String maxQueueSize) {
        this.maxQueueSize = maxQueueSize;
    }

    public static class StoneServerProvider {
        private int retry;
        private int timeout;
        private String serverName;
        private String serverVersion; // XXX.XXX.XXX.XXX  0.0.0.1 格式
        private List<String> basePackages;
        private String username;
        private String password;
        private String serviceKey;

        private final Map<String, String> serverAttributes = new HashMap<String, String>();


        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public String getServiceKey() {
            return serviceKey;
        }

        public void setServiceKey(String serviceKey) {
            this.serviceKey = serviceKey;
        }

        public Map<String, String> getServerAttributes() {
            return serverAttributes;
        }

        public int getRetry() {
            return retry;
        }

        public void setRetry(int retry) {
            this.retry = retry;
        }

        public int getTimeout() {
            return timeout;
        }

        public void setTimeout(int timeout) {
            this.timeout = timeout;
        }

        public List<String> getBasePackages() {
            return basePackages;
        }

        public void setBasePackages(List<String> basePackages) {
            this.basePackages = basePackages;
        }

        public String getServerName() {
            return serverName;
        }

        public void setServerName(String serverName) {
            this.serverName = serverName;
        }

        public String getServerVersion() {
            return serverVersion;
        }

        public void setServerVersion(String serverVersion) {
            this.serverVersion = serverVersion;
        }
    }
}
